package com.lhy.vaccine_stock.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lhy.vaccine_stock.entity.SysRegion;
import com.lhy.vaccine_stock.mapper.SysRegionMapper;
import com.lhy.vaccine_stock.service.ISysRegionService;
import com.lhy.vaccine_stock.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysRegionServiceImpl extends ServiceImpl<SysRegionMapper, SysRegion> implements ISysRegionService {

    @Autowired
    SysRegionMapper sysRegionMapper;

    @Override
    public R getProvince() {
        List<SysRegion> province = sysRegionMapper.getProvince();
        if (province.size()>0 && province!=null){
            return R.ok().put("data",province);
        }
        return R.error();
    }

    @Override
    public R getCity(String newValue) {
        List<SysRegion> city = sysRegionMapper.getCity(newValue);
        if (city.size()>0 && city!=null){
            return R.ok().put("data",city);
        }
        return R.error();
    }

    @Override
    public R getRegion(String newValue) {
        List<SysRegion> city = sysRegionMapper.getRegion(newValue);
        if (city.size()>0 && city!=null){
            return R.ok().put("data",city);
        }
        return R.error();
    }


}
